package com.lexed.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import org.junit.Test;

public class Jdbc {
	
	@Test
	public void show() throws Exception{
		// 加载驱动
		Class.forName("com.mysql.jdbc.Driver");
		// 创建连接
		String url = "jdbc:mysql://localhost:3306/emp";
		String user = "root";
		String password = "ok";
		Connection connection = DriverManager.getConnection
				(url, user, password);
		// 创建Statement对象操作数据
		Statement statement = connection.createStatement();
		
		int i = statement.executeUpdate(
	"insert into emp(empno,ename,job,sal,deptno) values(5566,'LUPEN','SALMAN',200,20)");
		
		System.out.println(i);
		connection.commit();
		
		statement.close();
		connection.close();
	}
	
}
